<?php
/**
 * Created by PhpStorm.
 * User: sosyuki
 * Date: 2018/6/14
 * Time: 10:41
 */

namespace Drupal\wx_mini_qr\Entity;


use Entity;

class WxMiniQr extends Entity {

  public $id;

  public $uid;

  public $module;

  public $name;

  public $value;

  public $number = 0;

  public $created;

  public function __construct(array $values = []) {
    parent::__construct($values, 'wx_mini_qr');
  }

  public function save() {
    if (empty($this->created)) {
      $this->created = REQUEST_TIME;
    }
    if (empty($this->uid)) {
      global $user;
      $this->uid = $user->uid;
    }
    return parent::save();
  }

}
